package merchant

import (
	"github.com/gin-gonic/gin"
	"organoid_public/global"
	"organoid_public/middleware"
)

func Setup(g gin.IRouter) {
	h, err := NewHandler()

	if err != nil {
		global.Log.Error("module", "app/sample", "function", "SetupRbac", "error", err.Error())
		panic(err)
	}

	g = g.Group("merchant")
	g.Use(middleware.NewLoginAuthMiddleware(global.Response).HandleFunc, middleware.NewDiscernAppMiddleware(global.Response).HandleFunc)
	{
		g.GET("detail", h.detail)
		g.POST("upsert", h.upsert)
		g.POST("bindStore", h.bindStore)
		g.POST("listPage", h.listPage)
	}
}
